<template>
    <div>
        <div class="head" id="head">
            <div class="head-left">
                <img src="@/assets/logo.png">
                <!-- <img :src="imgsrc"> -->
            </div>
            <div class="head-right"> 
                <span class='item' 
                    @click="home(1)" 
                    :class="currentpage==1?'active':''">
                    首页
                </span>
                <span class='item' 
                    @click="home(2)" 
                    :class="currentpage==2?'active':''">
                    关于我们
                </span>
                <span  class='item' 
                    @click="home(3)" 
                    :class="currentpage==3?'active':''">
                    联系我们
                </span>
            </div>
        </div>
    </div>
</template>
<script>
// import logo from '@/assets/logo.png'
export default {
    name:'Header',  
    props:{
        currentpage:{
            type:Number,
            required:true
        }
    },
    data(){
        return{
            // imgsrc:logo
        }
    },
    methods:{
        home(k){
            let o = k==1?'Home':k==2?'About':'Contact'
            this.$router.push({name:o})
            //let o = k == 1 ? {name:'Home'}: k == 2 ? {name:'About'} :{name:'Contact'}
            return
            if(k==1){
                this.$router.push({
                    name:'Home'
                })
            }else if(k==2){
                this.$router.push({
                    name:'About'
                })
            }else{
                this.$router.push({
                    name:'Contact'
                })
            }
            
        }
    }
}
</script>
<style scoped>
.head {
    width: 1200px;
    height: 50px;
    margin: auto;
    padding: 20px;
    background-color: transparent;
    z-index: 10;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
}
.head-left {
    width: 200px;
    height: 50px;
    float: left;
}
.head-right {
    width: 50%;
    height: 100%;
    float: right;
    display: flex;
    justify-content: space-around;
}
.item {
    color:#fff;
    font-size: 18px;
    padding: 10px 20px 40px;
    cursor:pointer;
}
.item:hover{
    color: #ff0;
    border-bottom: 2px solid #ff0;
}
.active {
    color: #ff0;
    border-bottom: 2px solid #ff0;
}
</style>